/******************************************************************************
 * Copyright (C) 2017 Chengdu Dlhd information industry co. LTD.
 * All Rights Reserved.
 * 本软件为成都顶联互动信息产业有限公司开发研制。未经本公司正式书面同意，其他任何个人、团体不得使用、复制、修改或发布本软件.
 *****************************************************************************/
package net.dgg.dggcloud.service.jrcrm.service.customer;

import net.dgg.dggcloud.service.common.base.service.BaseService;
import net.dgg.dggcloud.service.common.exception.BizException;
import net.dgg.dggcloud.service.entity.user.User;
import net.dgg.dggcloud.service.jrcrm.constant.CustomerConstant;
import net.dgg.dggcloud.service.jrcrm.dao.customer.CustomerDao;
import net.dgg.dggcloud.service.jrcrm.dao.customer.ProbelmDao;
import net.dgg.dggcloud.service.jrcrm.entity.customer.Customer;
import net.dgg.dggcloud.service.jrcrm.entity.customer.CustomerProblems;
import net.dgg.dggcloud.service.jrcrm.service.cms.CustomerRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 问题业务处理层
 * @ClassName: ProBlemService
 * @Author: 罗金
 * @Date: 2017年11月28 14:34:05
 * @Version V1.0
 */

@Service
public class ProBlemService extends BaseService {
    @Autowired
    private ProbelmDao probelmDao;

   public void save(CustomerProblems proBlem,User currUser){
       Long newProductId = keyWorker.nextId();
       proBlem.setId(newProductId);
       proBlem.setCreaterId(currUser.getId());
       proBlem.setCreaterName(currUser.getName()+currUser.getLoginName());
       proBlem.setCreaterOrgId(currUser.getOrgId());
       proBlem.setCreateTime(new Date());
       repository.save(proBlem);
   }

    /**
     * 查询客户问题列表
     */
    public List<Map> queryProblemList(Map map){
        return  probelmDao.queryProBlemListByParams(map);
    }

    /**
     * 查询客户问题列表统计
     */
    public Integer queryqueryProblemListCount(Map map){
        return  probelmDao.queryProBlemListCountByParams(map);
    }




}
